<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/4/8
  Time: 22:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<c:forEach items="${emails}" var="item" >
    <li class="treeview boxitem" id="${item.id}"><a href="${pageContext.request.contextPath}/mail/changeBox.shtml?id=${item.id}" id="changeBoxBtn"> <i
            class="fa fa-dashboard"></i> <span>${item.account}</span>
    </a>

    </li>
</c:forEach>

<script>
    $(function (){
        <c:forEach items="${emails}" var="item" >
        $.post('${pageContext.request.contextPath}/manager/showUnreadNumber.shtml',{"emailAccount":'${item.account}'},function(data){
//            alert(data);
            if(data>0){
                $("#${item.id} > a").append('<span class="label label-primary pull-right">'+data+'</span>');
            }

        });
        </c:forEach>
        $(".boxitem").removeClass('active');
        $("#${sessionScope.currentEmail.id}").addClass("active");


    });

</script>

